package com.pango.core.utils;

import javax.servlet.http.HttpServletRequest;

public class URLUtils {

	/**
	 * 获得请求路径
	 * @param request
	 * @return
	 */
	public static String getRequestPath(HttpServletRequest request) {
		String requestPath = request.getRequestURI() ;
		String queryParam = request.getQueryString();
		
		if(queryParam != null) {
			requestPath += "?" + request.getQueryString();
		}
		if (requestPath.indexOf("&") > -1) {// 去掉其他参数
			requestPath = requestPath.substring(0, requestPath.indexOf("&"));
		}
		// 去掉项目路径
		//requestPath = requestPath.substring(request.getContextPath().length() + 1);
		return requestPath;
	}
}
